package com.hhw.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.hhw.service.DelUserService;

/**
 * Servlet implementation class DodeleteUser
 */
@WebServlet("/DodeleteUser")
public class DodeleteUser extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public DodeleteUser() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		String user_id=request.getParameter("user_id");
		//Integer.parseInt(user_id);
		int id = Integer.parseInt(user_id);
		System.out.println("user_id="+user_id);
		DelUserService ps=new DelUserService();
		boolean b=ps.deleteUser(id);
		
		if(b){
		System.out.println("删除成功");
		}else{
			System.out.println("删除失败");
		}
		
		request.getRequestDispatcher("tousermanage").forward(request, response);
		
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
